﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Slf;
using SLLoggingClient.LoggingHost;

namespace SLLoggingClient
{
  public partial class MainPage : UserControl
  {
    public MainPage()
    {
      InitializeComponent();
      LoggerService.SetLogger(new ServiceClientLogger());
    }

    private void LogInfo(object sender, RoutedEventArgs e)
    {
      LoggerService.GetLogger().Warn(txtMessage.Text);
    }

    private void GetItems(object sender, RoutedEventArgs e)
    {
      var client = new LoggingServiceClient();
      client.GetLoggedItemsCompleted += delegate(object sender1, GetLoggedItemsCompletedEventArgs e1)
                                          {
                                            logViewer.ItemsSource = e1.Result;
                                            client.CloseAsync();
                                          };
      client.GetLoggedItemsAsync();
    }
  }
}
